/**
 * Created by Admin on 05.01.2015.
 */

var GlBuffer = (function ($) {
    return $.inherit({
        gl: null,
        buffer: null,
        itemSize: null,
        numItems: null,

        __constructor: function (gl, bufferData, itemSize, numItems, dataType, bufferType) {
            this.gl = gl;
            this.buffer = gl.createBuffer();
            this.itemSize = itemSize;
            this.numItems = numItems

            gl.bindBuffer(bufferType, this.buffer);
            gl.bufferData(bufferType, new dataType(bufferData), gl.STATIC_DRAW);
        },

        _destroy: function () {
            this.gl.deleteBuffer(this.buffer);
        }
    })
})(window["jQuery"]);